#ifndef WIDGET_H
#define WIDGET_H

#include <QWidget>
#include "regwidget.h"
#include "QThread/camerathread.h"
#include "baiduai.h"

const QString baiduSearchUrl = "https://aip.baidubce.com/rest/2.0/face/v3/search?access_token=%1";

namespace Ui {
class Widget;
}

class Widget : public QWidget
{
    Q_OBJECT

public:
    explicit Widget(QWidget *parent = nullptr);
    ~Widget();

    // 通过人脸搜索验证用户
    bool verifyUserByFace(const QString &accessToken, const QString &groupId, const QString &userId, const QByteArray &imgBase64);

private slots:
    void on_pushButton_3_clicked();
    //注册界面返回登录界面
    void RegToLogin();

    //接受图片--接着双缓冲
    void receiveImg(QImage);
    //登录的槽函数
    void on_pushButton_clicked();

private:
    Ui::Widget *ui;
    CameraThread *camThread;
    QImage img; //接受摄像头线程发送来的画面
    RegWidget * regWidget;

    // QWidget interface
protected:
    void paintEvent(QPaintEvent *event);
};

#endif // WIDGET_H
